Skip to content

Conversation

@ollym
Copy link
Contributor

@ollym ollym commented Feb 11, 2025

The X-Cloud-Trace-Context header that is used by Google Cloud predates the W3C specification. For backwards compatibility, some Google Cloud services continue to accept, generate, and propagate the X-Cloud-Trace-Context header. However, it is likely that these systems also support the traceparent header.

The X-Cloud-Trace-Context header has the following format:

X-Cloud-Trace-Context: TRACE_ID/SPAN_ID;o=OPTIONS

The fields of header are defined as follows:

  • TRACE_ID is a 32-character hexadecimal value representing a 128-bit number.
  • SPAN_ID is a 64-bit decimal representation of the unsigned span ID.
  • OPTIONS supports 0 (parent not sampled) and 1 (parent was sampled).

Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ollym! 👋 Thanks for opening this PR!

I'm not familiar with Google Cloud Platform propagation needs, so someone else with more familiarity will also need to review. My fellow maintainer, @arielvalentin, brought this up in the #otel-ruby channel on CNCF Slack, and we hope to have someone else take a look at it soon.

These suggestions are more for general adherence to this repo's structure.

Could you also add this gem to the ci-contrib.yml file so the tests will run as part of the CI?

@ollym
Copy link
Contributor Author

ollym commented Feb 12, 2025

Thanks, @kaylareopelle done

@ollym
Copy link
Contributor Author

ollym commented Feb 13, 2025

Updated against refactor: Define a single ruby required version - let me know what else I need to do

Copy link
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates, @ollym! It looks like the CI isn't able to run the tests:

rake aborted!
Don't know how to build task 'test' (See the list of available tasks with `rake --tasks`)
/home/runner/work/opentelemetry-ruby-contrib/opentelemetry-ruby-contrib/vendor/bundle/ruby/3.4.0/gems/rake-13.2.1/exe/rake:27:in '<top (required)>'
/opt/hostedtoolcache/Ruby/3.4.3/x64/bin/bundle:25:in 'Kernel#load'
/opt/hostedtoolcache/Ruby/3.4.3/x64/bin/bundle:25:in '<main>'
(See full trace by running task with --trace)

Are you able to run them locally?

@ollym
Copy link
Contributor Author

ollym commented Apr 22, 2025

Yea they run fine, i'm not up to speed with the CI or why it doesn't work, here's my terminal output:

google_cloud_trace_context % rake test
/Users/ollym/.rbenv/versions/3.4.1/lib/ruby/gems/3.4.0/gems/opentelemetry-api-1.4.0/lib/opentelemetry.rb:7: warning: logger was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
You can add logger to your Gemfile or gemspec to silence this warning.
Run options: --seed 55425

# Running:

..............

Finished in 0.001244s, 11254.0200 runs/s, 27331.1913 assertions/s.

14 runs, 34 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for 098f6bcd4621d373cade4e832627b4f6 to /Users/ollym/GitHub/ventrata/opentelemetry-ruby-contrib/propagator/google_cloud_trace_context/coverage.
Line Coverage: 98.31% (58 / 59)

EDIT: I think i figured it out, giving it another go

@ollym
Copy link
Contributor Author

ollym commented Apr 23, 2025

@kaylareopelle everything's now passing except Ruby 3.1

Error: unrecognized cop or department plugins found in /home/runner/work/opentelemetry-ruby-contrib/opentelemetry-ruby-contrib/.rubocop.yml
RuboCop failed!
Running RuboCop...

Any ideas what's wrong with RuboCop with this specific ruby version?

EDIT: I think i was missing some stuff in the gemfile, have copied it from the xray propagator

@ollym ollym requested review from dazuma and kaylareopelle April 23, 2025 14:37
@kaylareopelle
Copy link
Contributor

@ollym, nice work fixing the CI issues! 🎉

It looks like there's a few Rubocop offenses to address before we can wrap things up.

@ollym
Copy link
Contributor Author

ollym commented Apr 23, 2025

@kaylareopelle hoping this fixes it

@kaylareopelle
Copy link
Contributor

@kaylareopelle hoping this fixes it

@ollym - So close! One more offense: https://github.com/open-telemetry/opentelemetry-ruby-contrib/actions/runs/14624932201/job/41034882419?pr=1408#step:6:179

@dazuma, can you take another look at this PR? @ollym has addressed your feedback.

@ollym
Copy link
Contributor Author

ollym commented Apr 23, 2025

done

Copy link
Member

@dazuma dazuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Approved.

@dazuma dazuma changed the title feat: added google_cloud_platform propagator feat: added google_cloud_trace_context propagator Apr 29, 2025
@kaylareopelle kaylareopelle merged commit 266a8ba into open-telemetry:main Apr 30, 2025
62 checks passed
yiyuan-he pushed a commit to yiyuan-he/opentelemetry-ruby-contrib that referenced this pull request Apr 30, 2025
* added google_cloud_platform propagator

* leftover naming

* make regex const and remove unnecessary downcase

* Update CHANGELOG.md

Co-authored-by: Kayla Reopelle <[email protected]>

* Update Gemfile

Co-authored-by: Kayla Reopelle <[email protected]>

* Update README.md

Co-authored-by: Kayla Reopelle <[email protected]>

* Update version.rb

Co-authored-by: Kayla Reopelle <[email protected]>

* requested changes

* refactor: Define a single ruby required version

* Update opentelemetry-propagator-google_cloud_platform.gemspec

* rename to GoogleCloudTraceContext

* requested changes

* fix tests

* misunderstood

* whitespace

* Update README.md

* try fix ci

* Update version.rb

* Copy gemfile from xray

* fix rubocop issues

* Update Gemfile

---------

Co-authored-by: Kayla Reopelle <[email protected]>
Co-authored-by: Daniel Azuma <[email protected]>
yiyuan-he pushed a commit to yiyuan-he/opentelemetry-ruby-contrib that referenced this pull request May 14, 2025
* added google_cloud_platform propagator

* leftover naming

* make regex const and remove unnecessary downcase

* Update CHANGELOG.md

Co-authored-by: Kayla Reopelle <[email protected]>

* Update Gemfile

Co-authored-by: Kayla Reopelle <[email protected]>

* Update README.md

Co-authored-by: Kayla Reopelle <[email protected]>

* Update version.rb

Co-authored-by: Kayla Reopelle <[email protected]>

* requested changes

* refactor: Define a single ruby required version

* Update opentelemetry-propagator-google_cloud_platform.gemspec

* rename to GoogleCloudTraceContext

* requested changes

* fix tests

* misunderstood

* whitespace

* Update README.md

* try fix ci

* Update version.rb

* Copy gemfile from xray

* fix rubocop issues

* Update Gemfile

---------

Co-authored-by: Kayla Reopelle <[email protected]>
Co-authored-by: Daniel Azuma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants